﻿using SugarFrame.Node;
using UnityEngine;
using NodeState = Ease.EaseNode.Runtime.NodeState;

namespace Ease.EaseMission.Editor
{
    public static class NodeVisual
    {
        private static Color titleError = Color.red;

        private static Color stateNone = Color.gray;
        private static Color stateActive = Color.cyan;
        private static Color stateRunning = Color.green;
        private static Color stateOver = Color.blue;

        public static Color TitleError
        {
            get => titleError;
            set => titleError = value;
        }

        public static Color StateNone
        {
            get => stateNone;
            set => stateNone = value;
        }

        public static Color StateActive
        {
            get => stateActive;
            set => stateActive = value;
        }

        public static Color StateRunning
        {
            get => stateRunning;
            set => stateRunning = value;
        }

        public static Color StateOver
        {
            get => stateOver;
            set => stateOver = value;
        }

        public static Color GetStateColor(NodeState state)
        {
            Color color = Color.gray;
            switch (state)
            {
                case NodeState.None:
                    color = StateNone;
                    break;
                case NodeState.Start:
                    color = StateActive;
                    break;
                case NodeState.Running:
                    color = StateRunning;
                    break;
                case NodeState.Finish:
                    color = StateOver;
                    break;
            }

            return color;
        }
    }
}